package cn.fl.risk.controller;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.project.service.IPrjPrdDtlService;
import cn.fl.project.service.IPrjPrdPaySchMService;
import cn.fl.project.vo.PrjPrdDtlVO;
import cn.fl.risk.condition.RskPrdSignLogQueryCondition;
import cn.fl.risk.constant.RiskPrdSignLogConstant;
import cn.fl.risk.constant.RskSignOperLogConstant;
import cn.fl.risk.service.IRskPrdSignLogService;
import cn.fl.risk.service.IRskSignOperLogService;
import cn.fl.risk.vo.RskPrdSignLogVO;
import cn.fl.risk.vo.RskSignOperLogVO;
import cn.fl.system.constant.SysLogConstant;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import net.sf.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Description: 设备风险标记记录表 控制层
 */
@Controller
@RequestMapping("/risk/rskPrdSignLog")
public class RskPrdSignLogController extends BaseController {
	private static final Logger logger = LoggerFactory.getLogger(RskPrdSignLogController.class);

	/**
	 * RskPrdSignLog 服务层BEAN
	 */
	@Autowired
	private IRskPrdSignLogService rskPrdSignLogService;

	@Autowired
	private IPrjPrdDtlService prjPrdDtlService;

	@Autowired
	private IPrjPrdPaySchMService prjPrdPaySchMService;

	@Autowired
	private ICstBscInfoService cstBscInfoService;

	/**
	 * 数据字典 服务层BEAN
	 */
	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;

	/**
	 * 客户风险标记日志表
	 */
	@Autowired
	private IRskSignOperLogService rskSignOperLogService;

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toListPage", "加载RskPrdSignLog列表页面.", CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("risk/rskPrdSignLog/rskPrdSignLogList");
		this.prepare(request, mav);
		return mav;
	}

	/**
	 * 到VIN列表页面
	 */
	@RequestMapping(value = "/toVINListPage.do", method = { RequestMethod.GET})
	public ModelAndView toVINListPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toVINListPage", "加载RskVIN列表页面.", CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("risk/rskPrdSignLog/rskVINList");
		this.prepare(request, mav);
		return mav;
	}

	/**
	 * 到新增页面
	 */
	@RequestMapping(value = "/toAddPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toAddPage", "加载RskPrdSignLog Add页面.", CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("risk/rskPrdSignLog/rskPrdSignLogAdd");
		this.prepare(request, mav);
		return mav;
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toModifyPage", "加载RskPrdSignLog Modify页面.", CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("risk/rskPrdSignLog/rskPrdSignLogModify");
		String id=request.getParameter("id");
		RskPrdSignLogVO rskPrdSignLogVO = this.rskPrdSignLogService.selectById(Long.valueOf(id));
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Long prjPrdDtlId = null;
		String paySchNo = null;
		String signResNM = null;
		String crtTM = null;
		String mdfTM = null;
		PrjPrdDtlVO vo = null;
		RskPrdSignLogVO rskPrdvo = null;

		prjPrdDtlId = rskPrdSignLogVO.getPrjPrdDtlId();
		paySchNo = rskPrdSignLogVO.getPaySchNo();
		signResNM = rskPrdSignLogVO.getSignResCd();
		crtTM = sdf.format(rskPrdSignLogVO.getCrtTm());
		mdfTM = sdf.format(rskPrdSignLogVO.getMdfTm());
		vo = this.prjPrdDtlService.selectById(prjPrdDtlId);
		rskPrdvo = this.rskPrdSignLogService.selectChangVinPaySchNo(paySchNo);

		rskPrdSignLogVO.setCrtTMNM(crtTM);
		rskPrdSignLogVO.setMdfTMNM(mdfTM);
		//起租日期
		if(rskPrdvo !=null && rskPrdvo.getLsDt() != null){
			String str = rskPrdvo.getLsDt();
			String lsdt = str.substring(0,str.indexOf(" "));
			rskPrdSignLogVO.setLsDt(lsdt);
		}
		//资产状态
		List<KeyValueVO> prdStsCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_PRD_STS_CD);
		for (KeyValueVO prdStsCd : prdStsCdList) {
			if(vo !=null && vo.getPrdStsCd() != null){
				if (prdStsCd.getKey().equals(vo.getPrdStsCd())) {
					rskPrdSignLogVO.setPrdStsCd(prdStsCd.getValue());
				}
			}
		}
		// 查询数据库字典，查询项目类型
        List<KeyValueVO> prjTypeList = this.sysDictionaryApiService.getKvListAll(DictionaryConstant.CODE_PRJ_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
//		List<KeyValueVO> prjTypeList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_TYPE_CD);
		for (KeyValueVO prjTyp : prjTypeList) {
			if(rskPrdvo !=null && rskPrdvo.getPrjTypCd() != null){
				if (prjTyp.getKey().equals(rskPrdvo.getPrjTypCd())) {
					rskPrdSignLogVO.setPrjTypCd(prjTyp.getValue());
				}
			}

		}

		// 查询数据库字典，查询设备风险标记原因
		/*List<KeyValueVO> signResCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.PRD_RISK_SINGLOG);
		for (KeyValueVO signRes : signResCdList) {
			if (signRes.getKey().equals(signResNM)) {
				rskPrdSignLogVO.setSignResCd(signRes.getValue());
			}
		}*/
		// 查询数据库字典，查询事业部
		List<KeyValueVO> buOrgList = this.cstBscInfoService.searchBusinessOrgList();
		for (KeyValueVO buOrg : buOrgList) {
			if(rskPrdvo !=null && rskPrdvo.getBuOrgCd() != null) {
				if (buOrg.getKey().equals(rskPrdvo.getBuOrgCd())) {
					rskPrdSignLogVO.setBuOrgCd(buOrg.getValue());
				}
			}
		}
		this.prepare(request,mav);
		mav.addObject("rskPrdSignLogVO", rskPrdSignLogVO);
		return mav;
	}

	/**
	 * 到查看页面
	 */
	@RequestMapping(value = "/toSeePage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toSeePage(HttpServletRequest request, HttpServletResponse response) {
		BaseLogUtils.info(logger, "toSeePage", "加载RskPrdSignLog See页面.", CurrentThreadContext.getCurrentUserName());
		ModelAndView mav = new ModelAndView("risk/rskPrdSignLog/rskPrdSignLogSee");
		String id=request.getParameter("id");
		RskPrdSignLogVO rskPrdSignLogVO = this.rskPrdSignLogService.selectById(Long.valueOf(id));
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Long prjPrdDtlId = null;
		String paySchNo = null;
		String signResNM = null;
		String crtTM = null;
		String mdfTM = null;
		PrjPrdDtlVO vo = null;
		RskPrdSignLogVO rskPrdvo = null;

		prjPrdDtlId = rskPrdSignLogVO.getPrjPrdDtlId();
		paySchNo = rskPrdSignLogVO.getPaySchNo();
		signResNM = rskPrdSignLogVO.getSignResCd();
		crtTM = sdf.format(rskPrdSignLogVO.getCrtTm());
		mdfTM = sdf.format(rskPrdSignLogVO.getMdfTm());
		vo = this.prjPrdDtlService.selectById(prjPrdDtlId);
		rskPrdvo = this.rskPrdSignLogService.selectChangVinPaySchNo(paySchNo);

		rskPrdSignLogVO.setCrtTMNM(crtTM);
		rskPrdSignLogVO.setMdfTMNM(mdfTM);
		//起租日期
		if(rskPrdvo !=null && rskPrdvo.getLsDt() != null){
			String str = rskPrdvo.getLsDt();
			String lsdt = str.substring(0,str.indexOf(" "));
			rskPrdSignLogVO.setLsDt(lsdt);
		}
		//资产状态
		List<KeyValueVO> prdStsCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_PRD_STS_CD);
		for (KeyValueVO prdStsCd : prdStsCdList) {
			if(vo !=null && vo.getPrdStsCd() != null){
				if (prdStsCd.getKey().equals(vo.getPrdStsCd())) {
					rskPrdSignLogVO.setPrdStsCd(prdStsCd.getValue());
				}
			}
		}
		// 查询数据库字典，查询项目类型
        List<KeyValueVO> prjTypeList = this.sysDictionaryApiService.getKvListAll(DictionaryConstant.CODE_PRJ_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
//        List<KeyValueVO> prjTypeList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_TYPE_CD);
		for (KeyValueVO prjTyp : prjTypeList) {
			if(rskPrdvo !=null && rskPrdvo.getPrjTypCd() != null){
				if (prjTyp.getKey().equals(rskPrdvo.getPrjTypCd())) {
					rskPrdSignLogVO.setPrjTypCd(prjTyp.getValue());
				}
			}

		}

		// 查询数据库字典，查询设备风险标记原因
		List<KeyValueVO> signResCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.PRD_RISK_SINGLOG);
		for (KeyValueVO signRes : signResCdList) {
			if (signRes.getKey().equals(signResNM)) {
				rskPrdSignLogVO.setSignResCd(signRes.getValue());
			}
		}
		// 查询数据库字典，查询事业部
		List<KeyValueVO> buOrgList = this.cstBscInfoService.searchBusinessOrgList();
		for (KeyValueVO buOrg : buOrgList) {
			if(rskPrdvo !=null && rskPrdvo.getBuOrgCd() != null) {
				if (buOrg.getKey().equals(rskPrdvo.getBuOrgCd())) {
					rskPrdSignLogVO.setBuOrgCd(buOrg.getValue());
				}
			}
		}
		this.prepare(request,mav);
		mav.addObject("rskPrdSignLogVO", rskPrdSignLogVO);
		return mav;
	}

	//加载数据字典数据、传值等 ？
	public void prepare(HttpServletRequest request,ModelAndView mav){
		//List<KeyValueVO> prjTypCdList=this.sysDictionaryApiService.getKvList(RiskPrdSignLogConstant.CODE_GRP_NM_PRJ_TYP_CD,CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		//List<KeyValueVO> buOrgCdList = this.sysDictionaryApiService.getKvList(RiskPrdSignLogConstant.CODE_GRP_NM_BU_ORG_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		List<KeyValueVO> signResCdList = this.sysDictionaryApiService.getKvList(RiskPrdSignLogConstant.CODE_GRP_NM_SIGN_RES_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		List<KeyValueVO> signResTypeList = this.sysDictionaryApiService.getKvList(DictionaryConstant.CODE_GRP_NM_SIGN_RES_TYPE, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		//List<KeyValueVO> prdStsCdList = this.sysDictionaryApiService.getKvList(RiskPrdSignLogConstant.CODE_GRP_NM_PRD_STS_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		//mav.addObject("prjTypCdList", JSON.toJSONString(prjTypCdList));//项目类型
		//mav.addObject("buOrgCdList", JSON.toJSONString(buOrgCdList));//所属事业部
		mav.addObject("signResCdList", JSON.toJSONString(signResCdList));//设备标记原因
		mav.addObject("signResTypeList", JSON.toJSONString(signResTypeList));//设备标记原因
		//mav.addObject("prdStsCdList", JSON.toJSONString(prdStsCdList));//资产状态
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initRskPrdSignLogList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		RskPrdSignLogQueryCondition qc = new RskPrdSignLogQueryCondition();
		//TODO 设置查询条件？
		//设置查询条件？
		String paySchNo = request.getParameter("paySchNo");//支付表
		if (StringUtils.isNotEmpty(paySchNo)) {
			qc.setPaySchNo(paySchNo.trim());
		}
		String vin = request.getParameter("vin");//vin
		if (StringUtils.isNotEmpty(vin)) {
			qc.setVin(vin.trim());
		}
		String crtUsrNm = request.getParameter("crtUsrNm");//标记人
		if (StringUtils.isNotEmpty(crtUsrNm)) {
			qc.setCrtUsrNm(crtUsrNm);
		}
		String signResCd = request.getParameter("signResCd");//标记原因
		if (StringUtils.isNotEmpty(signResCd)) {
			qc.setSignResCd(signResCd);
		}
		String signResType = request.getParameter("signResType");//标记类型
		if (StringUtils.isNotEmpty(signResType)) {
			qc.setSignResType(signResType);
		}
		qc.setIsDel(0);
		qc.setSortName("CRT_TM");
		qc.setSortOrder("desc");

		page.setCondition(qc);

		BaseLogUtils.info(logger, "initRskPrdSignLogList", "初始化RskPrdSignLog列表页面数据.DATA:"+JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		Pager pager = this.rskPrdSignLogService.searchListPage(page);
		List<RskPrdSignLogVO> rskPrdSignLogVOlist = (List<RskPrdSignLogVO>) pager.getResultList();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		Long prjPrdDtlId = null;
		String paySchNon = null;
		String vinn = null;
		String signResNM = null;
		String crtTM = null;
		String mdfTM = null;
		PrjPrdDtlVO vo = null;
		RskPrdSignLogVO rskPrdvo = null;
		if(rskPrdSignLogVOlist != null && rskPrdSignLogVOlist.size() !=0){
			for (RskPrdSignLogVO rsk : rskPrdSignLogVOlist) {
				prjPrdDtlId = rsk.getPrjPrdDtlId();
				paySchNon = rsk.getPaySchNo();
				vinn = rsk.getVin();
				signResNM = rsk.getSignResCd();
				crtTM = sdf.format(rsk.getCrtTm());
				mdfTM = sdf.format(rsk.getMdfTm());
				vo = this.prjPrdDtlService.selectById(prjPrdDtlId);
				List<RskPrdSignLogVO> rskvolist = this.rskPrdSignLogService.selectChangVin(vinn);
				if(CollectionUtils.isNotEmpty(rskvolist)){
					if(rskvolist.size() == 1){
						rskPrdvo =rskvolist.get(0);
					}else {
						rskPrdvo = this.rskPrdSignLogService.selectChangVinPaySchNo(paySchNon);
					}
				}
				rsk.setCrtTMNM(crtTM);
				rsk.setMdfTMNM(mdfTM);
				//起租日期
				if(rskPrdvo !=null && rskPrdvo.getLsDt() != null){
					String str = rskPrdvo.getLsDt();
					String lsdt = str.substring(0,str.indexOf(" "));
					rsk.setLsDt(lsdt);
				}
				//资产状态
				List<KeyValueVO> prdStsCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_PRD_STS_CD);
				for (KeyValueVO prdStsCd : prdStsCdList) {
					if(vo !=null && vo.getPrdStsCd() != null){
						if (prdStsCd.getKey().equals(vo.getPrdStsCd())) {
							rsk.setPrdStsCd(prdStsCd.getValue());
						}
					}
				}
				// 查询数据库字典，查询项目类型
                List<KeyValueVO> prjTypeList = this.sysDictionaryApiService.getKvListAll(DictionaryConstant.CODE_PRJ_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
//                List<KeyValueVO> prjTypeList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_TYPE_CD);
				for (KeyValueVO prjTyp : prjTypeList) {
					if(rskPrdvo !=null && rskPrdvo.getPrjTypCd() != null){
						if (prjTyp.getKey().equals(rskPrdvo.getPrjTypCd())) {
							rsk.setPrjTypCd(prjTyp.getValue());
						}
					}

				}

				// 查询数据库字典，查询设备风险标记原因
				List<KeyValueVO> signResCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.PRD_RISK_SINGLOG);
				for (KeyValueVO signRes : signResCdList) {
					if (signRes.getKey().equals(signResNM)) {
						rsk.setSignResCd(signRes.getValue());
					}
				}
				// 查询数据库字典，查询事业部
				List<KeyValueVO> buOrgList = this.cstBscInfoService.searchBusinessOrgList();
				for (KeyValueVO buOrg : buOrgList) {
					if(rskPrdvo !=null && rskPrdvo.getBuOrgCd() != null) {
						if (buOrg.getKey().equals(rskPrdvo.getBuOrgCd())) {
							rsk.setBuOrgCd(buOrg.getValue());
						}
					}
				}
			}
		}
		ListPageVO<RskPrdSignLogVO> listPage = new ListPageVO<RskPrdSignLogVO>(rskPrdSignLogVOlist, pager.getTotalCount());
		return listPage;
	}

	/**
	 * 初始化VIN列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initVINList.do", method = {RequestMethod.GET})
	@ResponseBody
	public Object initVINList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		RskPrdSignLogQueryCondition qc = new RskPrdSignLogQueryCondition();
		//TODO 设置查询条件？
		//设置查询条件？
		String vin = request.getParameter("vin");//vin
		if (StringUtils.isNotEmpty(vin)) {
			qc.setVin(vin.trim());
		}
		qc.setIsDel(0);
		page.setCondition(qc);

		BaseLogUtils.info(logger, "initVINList", "初始化RskPrdSignLog列表页面数据.DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		Pager pager = this.rskPrdSignLogService.searchVINListPage(page);
		List<RskPrdSignLogVO> list = (List<RskPrdSignLogVO>) pager.getResultList();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		String crtTM = null;
		if(list != null && list.size() !=0) {
			for (RskPrdSignLogVO rsklist : list) {
				crtTM = sdf.format(rsklist.getCrtTm());
				rsklist.setCrtTMNM(crtTM);
			}
		}
		ListPageVO<RskPrdSignLogVO> listPage = new ListPageVO<RskPrdSignLogVO>(list, pager.getTotalCount());
		return listPage;
	}


	/**
	 * 单个删除数据
	 */
	@RequestMapping(value = "/removeById.do", method = {RequestMethod.GET })
	@ResponseBody
	public DataResultVO removeRskPrdSignLogById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据,主键参数为空!", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		try {
			boolean success = this.rskPrdSignLogService.removeById(Long.valueOf(id));
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
				BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据失败,ID:"+id, CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据成功,ID:"+id, CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据失败,ID:"+id+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据失败,系统错误.ID:"+id+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}


	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeRskPrdSignLogByIds(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String ids = request.getParameter("ids");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if (StringUtils.isEmpty(ids)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据,主键参数为空!", CurrentThreadContext.getCurrentUserName());
			return result;
		}

		List<Long> idsList = new ArrayList<Long>();
		JSONArray idsArray = JSONArray.fromObject(ids);
		for (Object object : idsArray) {
			idsList.add(Long.valueOf(object.toString()));
		}

		try {
			boolean success = this.rskPrdSignLogService.removeByIds(idsList);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
				BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据失败,ID:"+idsList.toString(), CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据成功,ID:"+idsList.toString(), CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据失败,ID:"+idsList.toString()+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeRskPrdSignLogByIds", "删除RskPrdSignLog数据失败,系统错误.ID:"+idsList.toString()+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 得到一条记录
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getRskPrdSignLogById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "getRskPrdSignLogById", "获取RskPrdSignLog数据,主键参数为空.", CurrentThreadContext.getCurrentUserName());
			return result;
		}

		try {
			RskPrdSignLogVO vo = this.rskPrdSignLogService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getRskPrdSignLogById", "获取RskPrdSignLog数据不存在,ID:"+id, CurrentThreadContext.getCurrentUserName());
			}
			result.setData(vo);
			BaseLogUtils.info(logger, "getRskPrdSignLogById", "获取RskPrdSignLog数据成功,ID:"+id, CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "getRskPrdSignLogById", "获取RskPrdSignLog数据失败,ID:"+id+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getRskPrdSignLogById", "获取RskPrdSignLog数据失败,系统错误.ID:"+id+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addRskPrdSignLog(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		RskPrdSignLogVO entity = null;//获取参数
		RskSignOperLogVO rskSignOperLogVO = null;
		try {
			entity = this.getRequestParamForRskPrdSignLog(request);//获取参数
			rskSignOperLogVO = this.getRequestParamForRskSignOperLog(request);
			rskSignOperLogVO.setOperTypCd(RskSignOperLogConstant.OPER_TYP_CD_ADD);
			// 新增一条客户风险标记操作数据
			rskSignOperLogService.add(rskSignOperLogVO);
			Long id = this.rskPrdSignLogService.add(entity);
			result.setData(id);
			BaseLogUtils.info(logger, "addRskPrdSignLog", "新增RskPrdSignLog数据成功,ID:"+id+".DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "addRskPrdSignLog", "新增RskPrdSignLog数据失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "addRskPrdSignLog", "新增RskPrdSignLog数据失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyRskPrdSignLog(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		RskPrdSignLogVO entity = null;
		RskSignOperLogVO rskSignOperLogVO = null;
		try {
			entity = this.getRequestParamForRskPrdSignLog(request);
			rskSignOperLogVO = this.getRequestParamForRskSignOperLog(request);
			rskSignOperLogVO.setOperTypCd(RskSignOperLogConstant.OPER_TYP_CD_MDF);
			// 新增一条客户风险标记操作数据
			rskSignOperLogService.add(rskSignOperLogVO);
			if(entity.getId()==null){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
				BaseLogUtils.info(logger, "modifyRskPrdSignLog", "修改RskPrdSignLog信息,主键参数为空！.", CurrentThreadContext.getCurrentUserName());
				return result;
			}

			boolean success = this.rskPrdSignLogService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
				BaseLogUtils.info(logger, "modifyRskPrdSignLog", "修改RskPrdSignLog数据失败.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
				return result;
			}
			BaseLogUtils.info(logger, "modifyRskPrdSignLog", "修改RskPrdSignLog数据成功.DATA:"+JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.info(logger, "modifyRskPrdSignLog", "修改RskPrdSignLog数据失败.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR+ex.getMessage());
			BaseLogUtils.error(logger, "modifyRskPrdSignLog", "修改RskPrdSignLog数据失败,系统错误.DATA:"+JSONObject.toJSONString(entity)+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 获取请求参数
	 * @param request 请求
	 * @return
	 */
	private RskPrdSignLogVO getRequestParamForRskPrdSignLog(HttpServletRequest request) throws BaseException{
		//获取参数
		String id = request.getParameter("id");//主键
		String paySchNo = request.getParameter("paySchNo");//支付表号
		String paySchNo1 = request.getParameter("paySchNo1");//支付表号
		String vin = request.getParameter("vin");//车架号(VIN)
		String signResCd = request.getParameter("signResCd");//标记原因 1.法律纠纷 2.在押非我司 3.未上牌 4.重大出险 5.拼装车 6.非标车
		String signRem = request.getParameter("signRem");//备注
		String signResType = request.getParameter("signResType");//标记类型
		RskPrdSignLogVO rskPrdvo = new RskPrdSignLogVO();
		if(paySchNo == null || paySchNo == ""){
			rskPrdvo = this.rskPrdSignLogService.selectPrjPrdDtlId(vin);
		}else {
			rskPrdvo = this.rskPrdSignLogService.selectPrjPrdDtlIdVin(vin,paySchNo);
		}
		//String paySchId = request.getParameter("paySchId");//支付表ID

		/*if(StringUtils.isEmpty(paySchNo)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "支付表号不能为空");
		}*/
		if(StringUtils.isEmpty(vin)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "车架号(VIN)不能为空");
		}
		if(StringUtils.isEmpty(signResCd)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "标记原因不能为空");
		}
		/*if(rskPrdvo == null){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_601, "支付信息不完整！");
		}*/


		//验证参数并赋值
		RskPrdSignLogVO entity = new RskPrdSignLogVO();
		if(rskPrdvo != null){
			entity.setPrjPrdDtlId(rskPrdvo.getPrjPrdDtlId());//项目产品明细ID
			entity.setPaySchId(rskPrdvo.getPaySchId());//支付表ID
			entity.setPaySchNo(rskPrdvo.getPaySchNo());//支付表号
		}
		entity.setVin(vin);//车架号(VIN)
		entity.setSignResCd(signResCd);//标记原因 1.法律纠纷 2.在押非我司 3.未上牌 4.重大出险 5.拼装车 6.非标车
		entity.setSignRem(signRem);//备注
		entity.setCrtUsrNm(CurrentThreadContext.getCurrentUserName());
		entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		entity.setSignResType(signResType);

//		if (StringUtils.isBlank(name)) {
//            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "名称不能为空.");
//      }
//      if (StringUtils.isNotBlank(num)) {
//          if (!StringUtils.isUnsignedNumeric(num)) {
//                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "请填写正确的数字.");
//          }
//      }

		Date tm=new Date();
		if (StringUtils.isNotBlank(id)) {
			entity.setId(Long.valueOf(id));
			entity.setMdfTm(tm);
			entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
		}else{
			entity.setCrtTm(tm);
			entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			//entity.setCrtUsrOrgCd(CurrentThreadContext.getCurrentOrgCd());//当前用户组织机构代码
			//entity.setOrgCd(CurrentThreadContext.getCurrentBuOrgCd());//事业部组织机构代码
		}

		return entity;
	}


	/**
	 * 得到一条记录
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getChangVin.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getChangVin(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String vin = request.getParameter("vin");
		String paySchNo = request.getParameter("paySchNo");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(vin)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据,主键参数为空.", CurrentThreadContext.getCurrentUserName());
			return result;
		}

		try {
			RskPrdSignLogVO rskvo = null;
			List<RskPrdSignLogVO> rskvolist = this.rskPrdSignLogService.selectChangVin(vin);
			if(CollectionUtils.isNotEmpty(rskvolist)){
				if(rskvolist.size() == 1){
					rskvo =rskvolist.get(0);
				}else {
					rskvo = new RskPrdSignLogVO();
					rskvo.setSize(rskvolist.size());
				}
			}
			if(rskvo !=null){
				//起租日期
				if(rskvo.getLsDt() != null){
					String str = rskvo.getLsDt();
					String lsdt = str.substring(0,str.indexOf(" "));
					rskvo.setLsDt(lsdt);
				}
				//资产状态
				if(rskvo.getPrdStsCd() != null && rskvo.getPrdStsCd() != "" ){
					List<KeyValueVO> prdStsCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_PRD_STS_CD);
					for (KeyValueVO prdStsCd : prdStsCdList) {
						if (prdStsCd.getKey().equals(rskvo.getPrdStsCd())) {
							rskvo.setPrdStsCd(prdStsCd.getValue());
						}
					}
				}

				// 查询数据库字典，查询项目类型
				if(rskvo.getPrjTypCd() != null && rskvo.getPrjTypCd() != "" ){
                    List<KeyValueVO> prjTypeList = this.sysDictionaryApiService.getKvListAll(DictionaryConstant.CODE_PRJ_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
//                    List<KeyValueVO> prjTypeList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_TYPE_CD);
					for (KeyValueVO prjTyp : prjTypeList) {
						if (prjTyp.getKey().equals(rskvo.getPrjTypCd())) {
							rskvo.setPrjTypCd(prjTyp.getValue());
						}
					}
				}

				// 查询数据库字典，查询事业部
				if(rskvo.getBuOrgCd() != null && rskvo.getBuOrgCd() != "" ){
					List<KeyValueVO> buOrgList = this.cstBscInfoService.searchBusinessOrgList();
					for (KeyValueVO buOrg : buOrgList) {
						if (buOrg.getKey().equals(rskvo.getBuOrgCd())) {
							rskvo.setBuOrgCd(buOrg.getValue());
						}
					}
				}

			}

			if(null == rskvo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据不存在,ID:"+vin, CurrentThreadContext.getCurrentUserName());
			}
			result.setData(rskvo);
			BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据成功,ID:"+vin, CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据失败,ID:"+vin+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getChangVin", "获取RskPrdSignLog数据失败,系统错误.ID:"+vin+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}


	/**
	 * 得到一条记录
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getChangVinPaySchNo.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getChangVinPaySchNo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String paySchNo = request.getParameter("paySchNo");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(paySchNo)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据,主键参数为空.", CurrentThreadContext.getCurrentUserName());
			return result;
		}

		try {
			RskPrdSignLogVO rskvo = this.rskPrdSignLogService.selectChangVinPaySchNo(paySchNo);
			if(rskvo !=null){
				//起租日期
				if(rskvo.getLsDt() != null){
					String str = rskvo.getLsDt();
					String lsdt = str.substring(0,str.indexOf(" "));
					rskvo.setLsDt(lsdt);
				}
				//资产状态
				if(rskvo.getPrdStsCd() != null && rskvo.getPrdStsCd() != "" ){
					List<KeyValueVO> prdStsCdList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_PRD_STS_CD);
					for (KeyValueVO prdStsCd : prdStsCdList) {
						if (prdStsCd.getKey().equals(rskvo.getPrdStsCd())) {
							rskvo.setPrdStsCd(prdStsCd.getValue());
						}
					}
				}

				// 查询数据库字典，查询项目类型
				if(rskvo.getPrjTypCd() != null && rskvo.getPrjTypCd() != "" ){
                    List<KeyValueVO> prjTypeList = this.sysDictionaryApiService.getKvListAll(DictionaryConstant.CODE_PRJ_TYPE_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
//                    List<KeyValueVO> prjTypeList = this.rskPrdSignLogService.searchCdList(DictionaryConstant.CODE_PRJ_TYPE_CD);
					for (KeyValueVO prjTyp : prjTypeList) {
						if (prjTyp.getKey().equals(rskvo.getPrjTypCd())) {
							rskvo.setPrjTypCd(prjTyp.getValue());
						}
					}
				}

				// 查询数据库字典，查询事业部
				if(rskvo.getBuOrgCd() != null && rskvo.getBuOrgCd() != "" ){
					List<KeyValueVO> buOrgList = this.cstBscInfoService.searchBusinessOrgList();
					for (KeyValueVO buOrg : buOrgList) {
						if (buOrg.getKey().equals(rskvo.getBuOrgCd())) {
							rskvo.setBuOrgCd(buOrg.getValue());
						}
					}
				}

			}

			if(null == rskvo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据不存在,ID:"+paySchNo, CurrentThreadContext.getCurrentUserName());
			}
			result.setData(rskvo);
			BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据成功,ID:"+paySchNo, CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.info(logger, "getChangVin", "获取RskPrdSignLog数据失败,ID:"+paySchNo+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getChangVin", "获取RskPrdSignLog数据失败,系统错误.ID:"+paySchNo+".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 获取客户风险标记日志请求参数
	 *
	 * @param request 请求
	 * @return
	 */
	private RskSignOperLogVO getRequestParamForRskSignOperLog(HttpServletRequest request) throws BaseException {
		//获取参数
		String bizId = request.getParameter("cstId");//客户ID
		String signResCd = request.getParameter("signResCd");//标记原因
		String signRem = request.getParameter("signRem");//操作备注
		String signResType = request.getParameter("signResType");//标记类型

		//验证参数并赋值
		RskSignOperLogVO entity = new RskSignOperLogVO();
		entity.setSignTypCd(RskSignOperLogConstant.SIGN_TYP_CD_PRD);//标记种类：1.客户 2.设备
		if (StringUtils.isNotEmpty(bizId)) {
			entity.setBizId(Long.valueOf(bizId));//客户ID
		}
		entity.setSignResCd(signResCd);//标记原因
		entity.setSignResType(signResType);
		entity.setSignRem(signRem);//操作备注

		Date tm = new Date();
		entity.setCrtTm(tm);
		entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		entity.setCrtUsrNm(CurrentThreadContext.getCurrentUserName());

		return entity;
	}

}

